Skip to content

fix(ext/node): dns resolveAny with real ANY query, retry/maxTimeout support#33684

Closed
bartlomieju wants to merge 1 commit intomainfrom
fix/dns-resolveany-maxtimeout
Closed

fix(ext/node): dns resolveAny with real ANY query, retry/maxTimeout support#33684
bartlomieju wants to merge 1 commit intomainfrom
fix/dns-resolveany-maxtimeout

Conversation

@bartlomieju
Copy link
Copy Markdown
Member

Supersedes #33577.

Summary

  • Replace queryAny's 11 separate DNS queries with a single ANY query by adding RecordType::ANY support to op_dns_resolve. For ANY queries, each record's actual type is used for formatting, and a record_type field is included to let the JS layer distinguish untagged string variants (A vs NS vs PTR vs CNAME).
  • Implement retry logic in the DNS resolver: timeout doubles on each retry attempt, capped by the new maxTimeout option.
  • Distinguish Interrupted (explicit cancel - don't retry) from TimedOut (hickory timeout - retry if attempts remain). This fixes the cancel regression from fix(ext/node): dns resolveAny with real ANY query, retry/maxTimeout support #33577 where Interrupted was retried, causing test-dns-channel-cancel.js to hang for 20s.
  • Add maxTimeout option validation to the Resolver constructor (valid range: 0 to 2^31-1).
  • Keep the short hickory timeout when cancel handle is present (from fix(ext/node): implement dns Resolver cancel() and timeout support #33580) so background resolver tasks clean up quickly after cancellation.

Enables 3 more Node.js compat tests:

  • parallel/test-dns-resolveany.js
  • parallel/test-dns-resolveany-bad-ancount.js
  • parallel/test-dns-resolver-max-timeout.js

Test plan

  • ./x test-compat test-dns-resolveany - both pass (resolveany + bad-ancount)
  • ./x test-compat test-dns-resolver-max-timeout passes
  • test-dns-channel-cancel.js passes in ~96ms (no regression)
  • test-dns-channel-timeout.js passes
  • All existing enabled DNS compat tests pass
  • tools/format.js and tools/lint.js --js pass

…upport

- Replace queryAny's 11 separate DNS queries with a single ANY query
  by adding RecordType::ANY support to op_dns_resolve. For ANY queries,
  each record's actual type is used for formatting, and a record_type
  field is included to let the JS layer distinguish untagged string
  variants (A vs NS vs PTR vs CNAME).
- Implement retry logic in the DNS resolver: timeout doubles on each
  retry attempt, capped by the new maxTimeout option.
- Distinguish Interrupted (explicit cancel - don't retry) from TimedOut
  (hickory timeout - retry if attempts remain).
- Add maxTimeout option validation to the Resolver constructor.
- Keep the short hickory timeout when cancel handle is present so
  background resolver tasks clean up quickly after cancellation.

Enables 3 more Node.js compat tests:
- parallel/test-dns-resolveany.js
- parallel/test-dns-resolveany-bad-ancount.js
- parallel/test-dns-resolver-max-timeout.js

Closes #33577
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant